<!--
 * @Descripttion: 
 * @Author: voanit
 * @Date: 2022-09-03 11:45:20
 * @LastEditors: voanit
 * @LastEditTime: 2022-09-03 14:57:00
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // function Person (name, say) {
    //   this.name = name
    //   this.say = say
    // }

    // // Person.prototype.fn = function () { }

    // var p = new Person('jack', () => { })

    // function Child (age) {
    //   this.age = age
    // }

    // /* 原型继承 */
    // Child.prototype = new Person('rose', () => { })
    // const c = new Child(18)
    // console.log(c.name);

    // class Person {
    //   constructor(name) {
    //     this.name = name
    //   }
    //   say () {
    //     /* 会挂载到原型上   // // Person.prototype.fn = function () { } */
    //   }
    // }
    // class Child extends Person {
    //   constructor(name, age) {
    //     super(name)  // 获取父类

    //     this.age = age
    //   }
    // }

    // // const p = new Person('jack')
    // // console.log(p);

    // const c = new Child('rose', 18)
    // console.log(c.say);

    /* 模拟实现链式编程 */
    class Person {
      say () {
        console.log(this, 1);
        return this
      }
      handle () {
        console.log(this, 2);
        return this
      }
      fn () {
        console.log(this, 3);
        return this
      }
    }

    const p = new Person()
    // p.say()
    // p.handle()
    // console.log(p, 8);
    p.say().handle().fn()


    /*
    es6
      1-var  let   const 
      2-扩展运算符、解构赋值、模板字符串、箭头函数[this指向问题]
      3-数组操作方法：forEach/map/filter/findIndex/find/every/some/reduce
      4-Set/Map   new  Set() / new  Map()
      5-Promise
        5-1 Promise.then().catch().finally().all().race().resolve().reject()
        5-2 async /  await  【es7】
      6-class
    */
  </script>
</body>

</html>